<?php 

class Utils{
	
	function getLimit(){
		$page = $_POST['page'];
		$rp = $_POST['rows'];
		if (!$page) 
			$page = 1;
		if (!$rp) 
			$rp = 10;
		
		$start = (($page-1) * $rp);
		$limit = "LIMIT $start, $rp";
		
		return $limit;
	}
	
	function getSort(){
		$sortname = $_POST['sort'];
		$sortorder = $_POST['order'];
		if (!$sortname) {
			return "";
		}
		if (!$sortorder) $sortorder = 'desc';
		$sort = "ORDER BY $sortname $sortorder";
		return $sort;
	}


	function getBusqueda(){
		
	}
}

?>